import { Component } from "react"
import PropTypes from "prop-types"
import './index.css'
class MyItem extends Component {
    static propTypes = {
        id: PropTypes.any.isRequired
    }
    checkChange = (id) => {
        return (event) => {
            this.props.checkedChange(id, event.target.checked)
        }
    }
    deleteChange = (id) => {
        return () => {
            this.props.deleteChange(id)
        }
    }

    render() {
        const { checked, id, title } = this.props
        return (
            <div className="body-check-item">
                <input checked={checked} onChange={this.checkChange(id)} type="checkbox" className="item"></input>
                <label className="label">{title}</label>
                {/* 豆瓣限制原因吧，反正显示不出来 */}
                {/* <img src={'//images.weserv.nl/?url'+img} alt={title} /> */}
                <span className="del" onClick={this.deleteChange(id)}>删除</span>
            </div>
        )
    }
}

export default MyItem